package com.audaque.springboot.foshanupload.web.springsecuritycasdemo.controller;


import com.audaque.springboot.foshanupload.authcore.controller.AbstractAuthenticationController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @author zgb
 * @desc ...
 * @date 2022-12-17 15:29:43
 */
@Slf4j
@RequestMapping("service")
@Controller
public class ServiceLoginoutController extends AbstractAuthenticationController {

    //认证请求的方式必须为POST
    @PostMapping("/login")
    @Secured(value = {"ROLE_ANONYMOUS"})
    public void login(HttpServletRequest request, HttpServletResponse response, HttpSession httpSession, @RequestParam(required = true) String username, @RequestParam(required = true) String password) throws Exception {
        //不响应，要响应则在拦截器或过滤器响应
        log.debug("不响应，要响应则在拦截器或过滤器响应");
    }


    @PostMapping("/logout")
    public void logout(HttpServletRequest request, HttpSession httpSession) {
        //不响应，要响应则在拦截器或过滤器响应
        log.debug("不响应，要响应则在拦截器或过滤器响应");
    }
}
